package com.code.entity.iterator;

import java.util.List;

/**
 * 具体迭代器
 *
 * @param <E>
 */
public class Node<E> implements NodeIterator<E> {

    private List<E> list;

    public Node(List<E> list) {
        this.list = list;
    }

    private int position = 0;

    @Override
    public boolean hasNext() {
        return position < list.size();
    }

    @Override
    public E next() {
        return list.get(position++);
    }
}
